package jdbc.dao;

import jdbc.apacheDBUtils.Student;

import java.util.List;

/**
 * Created with IntelliJ IDEA
 * Description:测试StudentDao
 * User:22954
 * Date:2024-05-25
 * Time:21:10
 */
public class TestStuDao {
    public static void main(String[] args) {
        StudentDao studentDao = new StudentDao();
        String sql = "select * from student where no > ?";
        List<Student> students = studentDao.QueryMulti(sql, 0);
        System.out.println("========query multi=========");
        for (Student student : students) {
            System.out.println(student);
        }
        sql = "select * from student where no = ?";
        Student student = studentDao.QuerySingle(sql, 3);
        System.out.println("========query single=========");
        System.out.println(student);
        sql = "select `name` from student where no = ?";
        Object o = studentDao.QueryScalar(sql, 4);
        System.out.println("========query scalar=========");
        System.out.println(o);
        sql = "delete from student where `name` = ?";
        int affectRow = studentDao.Update(sql, "george");
        System.out.println("========dml affected row=========");
        System.out.println(affectRow);
    }
}
